 <!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="./Public/Home/css/index.css"/>
		<link rel="stylesheet" type="text/css" href="./Public/Home/css/shoppingcart/shoppincart.css"/>
		<link rel="stylesheet" type="text/css" href="./Public/Home/css/content/content.css"/>
		<script src="./Public/Home/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="./Public/Home/js/content/count.js" type="text/javascript" charset="utf-8"></script>
		<script src="./Public/Home/js/content/js.js" type="text/javascript" charset="utf-8"></script>
		<script src="./Public/Home/js/JS.js" type="text/javascript" charset="utf-8"></script>
		<script src="./Public/Home/js/index.js" type="text/javascript" charset="utf-8"></script>
		<script src="./Public/Home/js/content/area.js" type="text/javascript" charset="utf-8"></script>
						<style type="text/css">
						.buy_area ul{
							margin-top: 10px;
						}
						.buy_area ul li{
							 margin-top: 10px;
						}
						.buy_area ul li span{
							font-size:12px;
							color: #999;
						}
						.buy_area li a{
				            border: 1px solid #999;
				            padding: 0 5px;
				        }
						.buy_area li a.red{
				            border: 1px solid red;
				        }
					</style>
		<script type="text/javascript">
        $(function () {
            $('.color_size_wrap a').click(function () {
                $(this).addClass('red').siblings().removeClass('red');
                //li标签的个数,也就是多少种属性
                var liLen = $('.color_size_wrap li').length;
                //选中的元素的个数
                var redLen = $('.red').length;
//              alert(liLen);
//              alert(redLen);
                if(liLen == redLen){
                    var combine = '';
                    var en = {};
                    //得到所有选中的商品属性id,然后发异步到货品列表查询,最后获得结果
                    $.each($('.red'),function(){
                        combine += $(this).attr('specId') + ',';
                    })
                    combine = combine.substring(0,combine.length-1);
                    en.aid = {{$_GET['aid']}};
                    en.combine = combine;
//                  alert(str);
                    $.ajax({
                    	type:"post",
                    	url:"{{U('Content/getAttr')}}",
                    	data:{en},
                    	//确定返回的数据类型
                    	dataType:'json',
                    	success:function(phpData){
                    		if(phpData ==0){
                    			alert('该商品已售完');
                    		}
                    	}
                    });
                }
            })
            //选择规格
            $(".sl").click(function(){
				var val = $(this).html();
				var str = '';
				$.each($(".red"), function() {
					str = str + $(this).html() + '/';
				});
				str = str.substring(0,str.length-1);
//								alert(str);
				$(".itemMessage").html('已选择:'+str);
			})
        })
    </script>
 
	</head>
	<body>
		
	<!--公共头部-->
	<input type="hidden" name="aid" id="aid" value="{{$_GET['aid']}}" />
	{{include file='../Common/header'}}	
		<!--详情页-->
		<div id="breadcrumb">
			<div class="main_bd">
				<!--<a href="" class="domain">电脑办公</a>
				>
				<a href="">电脑整机</a>-->
			</div>
			<div class="clearfix ">
				<!-- 放大镜 -->
				<div id="clearfix_box">
					<div class="pic">

							<img src="{{$goodsData['images'][0][0]}}" id="min" class="min" />

						<b class="sekuai" id="sk"></b>
						<div class="cover"></div>
					</div>
					<div class="min_pic">
						{{foreach from="$goodsData['images']" value="$v"}}
							<img _bigsrc="{{$v[1]}}" src="{{$v[0]}}"/>
						{{endforeach}}
					</div>
					<div class="large">
						<img src="{{$goodsData['images'][0][1]}}" class="max" />
					</div>
				</div>
				<!-- 放大镜结束 -->
				<div class="show_info">
					<div class="phone_buy">
						<h2>{{$goodsData['shopname']}}
							<p>{{$goodsData['introduction']}}</p>
						</h2>
						<div class="sale">
							<div class="ddprice">
								<div class="show_info_left">当当价</div>
								<div class="show_info_right">
									<b class="d_price ">¥{{$goodsData['shopprice']}}</b>
								</div>
								{{if value="$goodsData['marketprice'] neq 0"}}
									<div class="show_info_left" style="margin-left: 10px;">[商城价]</div>
									<div class="show_info_right">
										<span style="text-decoration: line-through;color: #C4C4C4;font-size: 12px;">¥{{$goodsData['marketprice']}}</span>
									</div>
								{{endif}}
							</div>
							
							<div class="sale_fw">
								<div class="show_info_left">服务</div>
								<div class="show_info_right">由 “ <b>{{$brandData['bname']}}</b> ” 发货，并提供售后服务。</div>
							</div>
							<div class="sale_fw">
								<div class="show_info_left">商品货号</div>
								<div class="show_info_right">NO.{{$goodsData['gnumber']}}</div>
							</div>
							<div class="sale_fw">
								<div class="show_info_left" style="margin-top: 15px;">品牌</div>
								<div class="show_info_right"><img style="width: 110px; height: 50px;" src="{{$brandData['logo']}}"/></div>
							</div>
							
						</div>
					</div>
					<div class="buy_area">
						<div class="color_size_wrap">
							<ul>
								{{foreach from="$TypeAttrData" value="$v"}}
									<li>
							            <span>{{$v['taname']}}</span>
										{{foreach from="$v['spec']" value="$u"}}
							            	<a class="sl" href="JavaScript:void(0);" specId="{{$u['gtid']}}">{{$u['gtvalue']}}</a>
										{{endforeach}}
							        </li>
								
								{{endforeach}}
						    </ul>
							
						</div>
					</div>
	
					<div class="sale_num">
						<div class="show_info_left">数量</div>
							<div class="show_info_right">
								<a href="javascript:;" class="sale_jian"></a>
								<input type="text" name="" class="inpt" value="1">
								<a href="javascript:;" class="sale_jia"></a>
								<span>件</span>
							</div>
					</div>
					<div class="itemMessage">

					</div>
					
					<div class="newpresale">
						<a href="JavaScript:;" class="phone_buy_button"></a>
						<a href="{{U('Cart/index',["aid"=>Q('get.aid'),"bid"=>Q('get.bid'),'cid'=>$_GET['cid']])}}" class="buy_now_button"></a>
					</div>
				</div>
				
				
		<script type="text/javascript">
			$(".phone_buy_button").click(function(){
				
			var liLen = $('.color_size_wrap li').length;
            //选中的元素的个数
            var redLen = $('.red').length;
//              alert(liLen);
//              alert(redLen);
            if(liLen == redLen){
                var combine = '';
                var en = {};
                //得到所有选中的商品属性id,然后发异步到货品列表查询,最后获得结果
                $.each($('.red'),function(){
                    combine += $(this).siblings('span').html() + ':' + $(this).html() + ',';
                })
                //货品文字
                combine = combine.substring(0,combine.length-1);
                
                	//货品数字
                	var combines='';
					$.each($('.red'),function(){
                        combines += $(this).attr('specId') + ',';
                    })
                    combines = combines.substring(0,combines.length-1);
                    
				var data = {};
				data.title = "{{$goodsData['shopname']}}";
				data.price = {{$goodsData['shopprice']}};
				data.val = $(".inpt").val();
				data.aid = {{$_GET['aid']}};
				data.combine = combine;
				data.combineNum = combines;
				data.bname = "{{$brandData['bname']}}";
				data.src = "{{$goodsData['images'][0][0]}}";
				data.marketprice = {{$goodsData['marketprice']}};
				data.number = {{$goodsData['gnumber']}};
				data.bid = {{$brandData['bid']}};
					$.ajax({
						type:"post",
						url:"{{U('Content/getShop')}}",
						data:{data},
						dataType:'text',
						success:function(phpData){
							console.log(phpData);
							if(phpData == 1){
								location.href="{{U('Cart/index')}}"
							}
						}
					});
				}
			})
		</script>
		
		
		</div>
	<!-- 商品展示区域 end  -->
	<!-- 商品详情 begin  -->
	<div id="all_tab_panel_box">
		
		<!-- 左侧区域 begin-->
		<div class="aside">
			<div class="abox">
				<h3>相关分类</h3>
				<ul>
					{{foreach from="$cateData" value="$v"}}
						<li>
							<a href="JavaScript:;">{{$v['cname']}}</a>
						</li>
					{{endforeach}}
				</ul>
			</div>

			<div class="abox abox_f3">
				<h3>推广商品</h3>
				<ul>
					{{foreach from="$goods" value='$v'}}
					<li>
						<a href="{{U('Content/index',array("aid"=>$v['aid'],'bid'=>$v['brand_bid'],'cid'=>$_GET['cid']))}}"><img src="{{$v['pic']}}" alt=""  style="width: 150px;height: 150px;"/>{{$v['shopname']}}</a>

							<p class="reds">{{$brandData['bname']}}</p>

						<p class="d_price">¥{{$v['shopprice']}}</p>
					</li>
					{{endforeach}}
					
				</ul>
			</div>
		</div>
		<!-- 左侧区域end -->

		 <!-- 商品详情 begin  -->
		<div class="all_tab_panel">
			<div class="all_tab_div">
				<div class="tab_top" style="border: none;">
					<a href="" class="xiangqing">商品详情</a>
				</div>
			</div>
			<div class="foursort_style">
				<ul class="foursort_style_frame">
					<li>
							<span>品牌：</span>
							<a href="">{{$brandData['bname']}}</a>
						</li>
					{{foreach from="$goodsAttrData" value="$v"}}
						<li>
							<span>{{$v['taname']}}：</span>
							<a href="">{{$v['gtvalue']}}</a>
						</li>
					{{endforeach}}

				</ul>
			</div>
			<div class="foursort_img" style="border: 1px solid #E9E9E9;">
				<div style="background: #F5F5F5;height: 30px;color: #404040;line-height:30px;font-weight:bold;padding-left:17px;font-size: 12px;">
					详情
				</div>
				<div style="margin-top: 30px;margin-left: 30px;">{{$goodsData['intro']}}</div>
				
			</div>
			
			<div class="all_tab_div" style="background: #EFEFEF;">
				<div class="tab_top" style="border: none;margin-top: 10px;">
					<a href="JavaScript:;">商品评论</a>
				</div>
				<div style="width: 988px;height: auto;float: left;">
					
<!-- 多说评论框 start -->
	<div class="ds-thread" data-thread-key="{{$goodsData['aid']}}" data-title="{{$goodsData['shopname']}}" data-url="{{U('Content/index',array('aid'=>$goodsData['aid']))}}"></div>
<!-- 多说评论框 end -->
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"dangdangshop"};
	(function() {
		var ds = document.createElement('script');
		ds.type = 'text/javascript';ds.async = true;
		ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
		ds.charset = 'UTF-8';
		(document.getElementsByTagName('head')[0] 
		 || document.getElementsByTagName('body')[0]).appendChild(ds);
	})();
	</script>
<!-- 多说公共JS代码 end -->
		
				</div>
			</div>


		</div>
		 <!-- 商品详情 end -->

	</div>




	<!-- 商品详情 end -->

		 <!--公共尾部-->
		{{include file='../Common/footer'}}
		

	</body>
</html>
